 
<!-- <link rel="stylesheet" href="${ctxStatic}/modules/sys/sysDesktop.css?${_version}"> -->

<% layout('/layouts/default.html', {title: '数据管理', libs:
['validate','fileupload','ueditor','dataGrid']}){ %>

<div class="content pb0">

<#form:form id="inputForm" model="${census}"
		 class="form-horizontal">
		
	<!-- Info boxes -->
	<div class="row">
		<div class="col-md-3 col-sm-6 col-xs-12">
			<div class="info-box">
				<span class="info-box-icon bg-aqua"><i class="fa fa-cog"></i></span>
				<div class="info-box-content">
					<span class="info-box-text">系统用户数</span>
					<span class="info-box-number">${census.sysUserNum}</span>
				</div>
				<!-- /.info-box-content -->
			</div>
			<!-- /.info-box -->
		</div>
		<!-- /.col -->
		<div class="col-md-3 col-sm-6 col-xs-12">
			<div class="info-box">
				<span class="info-box-icon bg-red"><i class="fa fa-google-plus"></i></span>
				<div class="info-box-content">
					<span class="info-box-text">小程序用户数</span>
					<span class="info-box-number">${census.xcxadminNum}</span>
				</div>
				<!-- /.info-box-content -->
			</div>
			<!-- /.info-box -->
		</div>
		<!-- /.col -->

		<!-- fix for small devices only -->
		<div class="clearfix visible-sm-block"></div>

		<div class="col-md-3 col-sm-6 col-xs-12">
			<div class="info-box">
				<span class="info-box-icon bg-green">
				<i class="fa fa-users"></i></span>
				<div class="info-box-content">
					<span class="info-box-text">商户数</span>
					<span class="info-box-number">${census.shanghuNum}</span>
				</div>
				<!-- /.info-box-content -->
			</div>
			<!-- /.info-box -->
		</div>
		
		
		<!-- /.col -->
		<div class="col-md-3 col-sm-6 col-xs-12">
			<div class="info-box">
				<span class="info-box-icon bg-yellow"><i class="fa fa-internet-explorer"></i></span>

				<div class="info-box-content">
					<span class="info-box-text">商品总数</span>
					<span class="info-box-number">${census.goodsNum}</span>
				</div>
				<!-- /.info-box-content -->
			</div>
			<!-- /.info-box -->
		</div>
		<!-- /.col -->
	</div>
	<!-- /.row -->
	<div class="row">
		<div class="col-md-12">
			<div class="box">
				<div class="box-header with-border">
					<h3 class="box-title">报告</h3>
					<div class="box-tools pull-right">
						<button type="button" class="btn btn-box-tool" data-widget="collapse">
							<i class="fa fa-minus"></i>
						</button>
												
					</div>
				</div>
				
				<!-- ./box-body -->
				<div class="box-footer">
					<div class="row">
						<div class="col-sm-6 col-xs-12">
							<div class="description-block border-right">
								
								<h5 class="description-header">
								${census.ordersNum}
								
								
								</h5>
								<span class="description-text">订单数</span>
							</div>
							<!-- /.description-block -->
						</div>
						<!-- /.col -->
						<div class="col-sm-6 col-xs-12">
							<div class="description-block border-right">
								
								<h5 class="description-header">￥${census.moneyNum}
								
								</h5>
								<span class="description-text">总销售额</span>
							</div>
							<!-- /.description-block -->
						</div>
						<div class="col-sm-6 col-xs-12">
							<div class="description-block border-right">

								<h5 class="description-header">￥${census.grossProfit}

								</h5>
								<span class="description-text">总利润</span>
							</div>
							<!-- /.description-block -->
						</div>
						<div class="col-sm-6 col-xs-12">
							<div class="description-block border-right">

								<h5 class="description-header">￥${census.expenditure}

								</h5>
								<span class="description-text">支出</span>
							</div>
							<!-- /.description-block -->
						</div>
						<div class="col-sm-6 col-xs-12">
							<div class="description-block border-right">

								<h5 class="description-header">￥${census.profitMargin}%

								</h5>
								<span class="description-text">总体利润率</span>
							</div>
							<!-- /.description-block -->
						</div>
						
					</div>
					<!-- /.row -->
				</div>
				<!-- /.box-footer -->
			</div>
			<!-- /.box -->
		</div>
		<!-- /.col -->
	</div>
	<div class="row">
		<div class="col-md-12">
			<div class="box">
				<div class="box-header with-border">
					<h3 class="box-title" id="title"></h3>
					<div class="box-tools pull-left">
						<samp>年月</samp>
						<input style="margin-right: 35px" type="text" id="date" onclick="WdatePicker({startDate:'%y-%M',dateFmt:'yyyy-MM',alwaysUseStartDate:true,onpicking:function(dp){

							$.get('${ctx}/desktopByTime', {beingTime : dp.cal.getNewDateStr(),}, function(data) {
								console.log(data)
								if(data==null){

										$('#yMoneyNum').html('0')
										$('#yGrossProfit').html('0')
										$('#yProfitMargin').html('0%')
										$('#yExpenditure').html('0')
									}else {
										$('#yMoneyNum').html(data.moneyNum)
										$('#yGrossProfit').html(data.grossProfit)
										$('#yProfitMargin').html((data.grossProfit/data.moneyNum*100).toFixed(2)+'%')
										$('#yExpenditure').html(data.expenditure)
						            }
						     }, 'json');
						}})"/>
					</div>

					<div class="box-tools pull-right">
						<button type="button" class="btn btn-box-tool" data-widget="collapse">
							<i class="fa fa-minus"></i>
						</button>
					</div>

				</div>

				<!-- ./box-body -->
				<div class="box-footer">
					<div class="row">
						<!-- /.col -->
						<div class="col-sm-4 col-xs-12">
							<div class="description-block border-right">

								<h5 class="description-header" id="yMoneyNum">

								</h5>
								<span class="description-text">总销售额</span>
							</div>
							<!-- /.description-block -->
						</div>
						<div class="col-sm-4 col-xs-12">
							<div class="description-block border-right">

								<h5 class="description-header" id="yGrossProfit">

								</h5>
								<span class="description-text">总利润</span>
							</div>
							<!-- /.description-block -->
						</div>
						<div class="col-sm-4 col-xs-12">
							<div class="description-block border-right">

								<h5 class="description-header" id ="yExpenditure">

								</h5>
								<span class="description-text">支出</span>
							</div>
							<!-- /.description-block -->
						</div>
						<div class="col-sm-4 col-xs-12">
							<div class="description-block border-right">

								<h5 class="description-header" id="yProfitMargin">

								</h5>
								<span class="description-text">总体利润率</span>
							</div>
							<!-- /.description-block -->
						</div>

					</div>
					<!-- /.row -->
				</div>
				<!-- /.box-footer -->
			</div>
			<!-- /.box -->
		</div>
		<!-- /.col -->
	</div>
	<!-- /.row -->
	</#form:form>
</div>
<footer class="main-footer m0">
	<div class="pull-right hidden-xs">当前版本： ${@Global.getConfig('productVersion')}</div>
	&copy; ${@DateUtils.getYear()} ${@Global.getConfig('productName')} 
</footer>
<% } %>
<script>
$(window).resize(function(){
	var footerHeight  = $('.main-footer').outerHeight() || 0;
	var windowHeight  = $(window).height();
	$('.content').css('min-height', windowHeight - footerHeight)
}).resize();
window.onload=function (){
	var month=(new Date().getMonth()+1)>9?(new Date().getMonth()+1):"0"+(new Date().getMonth()+1)
	var date = new Date().getFullYear()+ "-"+month;
	$('#date').val(date)
	$.get("${ctx}/desktopByTime", {
		beingTime : date,
	}, function(data) {
		if(data==null){
			$('#yMoneyNum').html('0')
			$('#yGrossProfit').html('0')
			$('#yProfitMargin').html('0%')
			$('#yExpenditure').html('0')
		}else {
			$('#yMoneyNum').html(data.moneyNum)
			$('#yGrossProfit').html(data.grossProfit)
			$('#yProfitMargin').html((data.grossProfit/data.moneyNum*100).toFixed(2)+'%')
			$('#yExpenditure').html(data.expenditure)
		}

	}, 'json');
}

</script>